package org.roger.search;

import java.io.IOException;

import org.apache.lucene.index.Term;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.WildcardQuery;

public class SpatialSearch extends LuceneSearchBase{
	
	//单位是千米
	private double dist;
	
	//原点
	private double lng;
	private double lat;
	
	public SpatialSearch(double lng,double lat,double dist){
		this.dist = dist;
		this.lng = lng;
		this.lat = lat;
	}
	

	@Override
	public Query getSearchQuery() {
		Term term = new Term("keyword","*饭店*");  
		WildcardQuery query = new WildcardQuery(term);
		return query;
	}

	@Override
	public Sort getSort() {
		// TODO Auto-generated method stub
		return null;
	}
	
	public static void main(String[] args) {
		SpatialSearch search = new SpatialSearch(116.430459,39.939802,1.6);
		try {
			Long s1 = System.currentTimeMillis();
			search.search("D:/lucene/spatial");
			System.out.println("cost time:"+(System.currentTimeMillis()-s1));
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
